package Semantic;

import Syntactic.Environment;

public class Symbol
{
	public String name;			// name of the symbol
	public SymbolType type;		// type of symbol
	public int dimension = 0;	// 0 for NORMAL, OTHERS FOR ARRAY
	public String label;
	
	// this is used to refer a symbol to another Scope/symbolTable 
	// (e.g., "record myrec ...", then the symbol "myrec" will refer to a new scope/symbolTable)
	Environment env = null;
	
	public Symbol(){}
	
	public Symbol(String name)
	{
		this.name = name;
	}
	
	public String toString()
	{
		return this.name;
	} 
	
	/**
	 * Override equals
	 */
	public boolean equals(Object obj)
	{
		if (obj == null)	
			return false;
		else if (obj.getClass() != this.getClass())
			return false;
		else if (obj == this)
            return true;
		
		Symbol symbol = (Symbol)obj;
		return (symbol.toString().equals(this.toString()));        
	}
	
	
}
